//
//  MqInfoTopicTableViewCell.m
//  Meiqi
//
//  Created by 王郑 on 16/1/16.
//  Copyright © 2016年 KFC. All rights reserved.
//

#import "MqInfoTopicTableViewCell.h"

@implementation MqInfoTopicTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _topicImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 100*kHeightBase)];
       // _topicImageV.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_topicImageV];
        
        _introLabel = [[UILabel alloc] initWithFrame:CGRectMake(10 * kWidthBase, _topicImageV.bottom + 10*kHeightBase, kScreenWidth - 20 * kWidthBase, 80 * kHeightBase)];
       // _introLabel.backgroundColor = [UIColor yellowColor];
        _introLabel.numberOfLines = 3;
        _introLabel.textColor = [UIColor grayColor];
        _introLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_introLabel];
        
        _interLabel = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth - 105 * kWidthBase, _introLabel.bottom, 100 * kWidthBase, 30*kHeightBase)];
       // _interLabel.backgroundColor = [UIColor greenColor];
        _interLabel.textColor = [UIColor redColor];
        _interLabel.text = @"进入专题 >>";
        _interLabel.font = [UIFont systemFontOfSize:14];
        _interLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_interLabel];
        
        
        
    }
    
    return self;
}


- (void)setModel:(MqInfoTopicModel *)model
{
    
    _model = model;
    
    // 赋值
    [_topicImageV sd_setImageWithURL:[NSURL URLWithString:model.ztImg] placeholderImage:[UIImage imageNamed:@"infoplaceholder"]];
    
    // 修改label上文字的行边距
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",model.intro]];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    
    [paragraphStyle setLineSpacing:10];//调整行间距
    
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [model.intro length])];
    
    _introLabel.attributedText = attributedString;
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
